package com.study.base.reflection;

import com.study.base.io.nio.Test;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class MethodTest {
    public static void main(String[] args) {
        for (Method method : Test.class.getMethods()) {
            if(method.getName().equals("test")){
                try {
                    Object result = method.invoke(new Test(),null);
                    if(result instanceof Void){
                        System.out.println("void");
                    }
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    public static class Test{
        public void test(){
            System.out.println("test");
        }
    }
}
